package com.example.demo.study.lambda;

/**
 * @Author：zhoutaoming
 * @name：Formula
 * @Date：2023/10/28 17:55
 * @Version 1.0
 */
public interface Formula {
    //计算
    double calculate(int a);

    //开方
    default double sqrt(int a){
        return Math.sqrt(a);
    }

    public static void main(String[] args) {
        Formula formula = new Formula() {
            @Override
            public double calculate(int a) {
                return a+1;
            }
        };
        System.out.println(formula.calculate(5));
        System.out.println(formula.sqrt(10));
    }
}
